package com.innerchic.weqiuqiu.ui;

import android.content.Intent;
import android.text.Html;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;

import com.innerchic.annotations.base.ActivitySetting;
import com.innerchic.annotations.base.BindActivityLayoutHolder;
import com.innerchic.mapper.app.SuperActivity;
import com.innerchic.mapper.tool.SystemTool;
import com.innerchic.weqiuqiu.BuildConfig;
import com.innerchic.weqiuqiu.R;

/**
 * ================================================
 * 作    者：贾恒飞 >>> 17515250730@163.com
 * 项    目：wedudu
 * 日    期：2022/1/13 14:08
 * 包    名：com.innerchic.weqiuqiu.ui
 * 描    述：配置页面
 * Create by zFox from AndroidStudio4.2
 * ================================================
 */
@BindActivityLayoutHolder
@ActivitySetting(layout = "activity_config", modificationActionBar = false, textTheme = true, swipe = true)
public class ConfigActivity extends SuperActivity {

    private ConfigActivityLayoutHolder holder;

    @Override
    public void create() {
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            getSupportActionBar().setTitle(Html.fromHtml("<font color='#000'>系统配置</font>"));
        }

        //初始化版本信息
        String versionName = "版本:v" + BuildConfig.VERSION_NAME;
        holder.versionName.setText(versionName);

        //监听
        holder.baseInfo.setOnClickListener(v -> {
            showToast("25岁 未婚 190cm/85kg");
        });
        holder.userConfig.setOnClickListener(v -> {
            showToast("不需要账号登录 (*^▽^*)");
        });
        holder.testServiceText.setOnClickListener(v -> {
            showToast("测试服务已关闭*_*");
//            Intent intent = new Intent(this, MainActivity.class);
//            startActivity(intent);
        });
        holder.aboutMe.setOnClickListener(v -> {
            showToast("我很可爱 (*╹▽╹*)");
        });
        holder.yonghuxieyi.setOnClickListener(v -> {
            Intent intent = new Intent(this, TextActivity.class);
            intent.putExtra("page_title", "用户协议");
            intent.putExtra("content_text_info", getUserInfo());
            startActivity(intent);
        });
        holder.yinsizhengce.setOnClickListener(v -> {
            Intent intent = new Intent(this, TextActivity.class);
            intent.putExtra("page_title", "隐私政策");
            intent.putExtra("content_text_info", getPrivacyPolicy());
            startActivity(intent);
        });
    }

    @Override
    public void destroy() {

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.close_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        if (item.getItemId() == R.id.action_close) {
            finish();
        }
        return super.onOptionsItemSelected(item);
    }


    private String getPrivacyPolicy() {
        return null;
    }

    private String getUserInfo() {
        return null;
    }

}
